<?php



namespace app\api\controller;

use app\common\controller\Api;
use think\Db;

/**
 * h会议安排
 */
class Photo extends Api
{

    protected $noNeedLogin = [''];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = ['*'];


    public function getallphoto()
    {

        $list = Db::name('photos')->select();

        foreach ($list as $key => $value){

            $list[$key]['image'] = cdnurl($value['image'], true);
            $list[$key]['addtime'] = date('m-d',$value['addtime']);
        }



        $this->success('',$list);

    }

    // 获取图片

    public function getphotobyid(){

        $id = $this->request->request('id');

        $info = Db::name('photos')->where('id',$id)->find();

        $info['image'] = cdnurl($info['image'], true);


        $images=$info['images'];

        $images=explode(',',$images);

        $array=[];
        foreach ($images as $key => $value){

            $arr['s']=0;
            $arr['img']=cdnurl($value, true);

            $array[]=$arr;

        }


        $files=$info['files'];
        $files=explode(',',$files);
        foreach ($files as $key => $value){

            $arr['s']=0;
            $arr['img']=cdnurl($value, true);

            $array[]=$arr;

        }

        $info['images'] =$array;

        $this->success('图片下载详情',$info);


    }




}
